#include "StdAfx.h"
#include ".\bufferhelper.h"

template<class T>
CBufferHelper<T>::CBufferHelper( unsigned int iBufSize )
:m_pBuf(NULL)
,m_bIsArray(true)
{
	m_pBuf = new T[iBufSize];
	memset(m_pBuf,0,iBufSize);
}

template<class T>
CBufferHelper<T>::CBufferHelper( void )
:m_pBuf(NULL)
,m_bIsArray(false)
{
	m_pBuf = new T;
}

template<class T>
CBufferHelper<T>::~CBufferHelper( void )
{
	if (NULL != m_pBuf)
	{
		if (m_bIsArray)
		{
			delete [] m_pBuf;
		}
		else
		{
			delete m_pBuf;
		}
		m_pBuf = NULL;
	}
}
